<?php
	/**
 	 * Main controller class
 	 */
	class MainController extends Controller
	{
		/**
	 	 * page title
	 	 */
		public $page_title = LANG_WELCOME;
		
		/**
	 	 * page layout
	 	 */
		public $layout = 'main';
		
		/**
	 	 * necessary helpers
	 	 */
		public $helpers = array ('html');
		
		/**
	 	 * necessary javascript files
	 	 */
		public $javascript = array("TreeMenu");
		
		/**
	 	 * necessary components
	 	 */
		public $components = array ("TreeMenu");
		
		/**
		 * defines whether the controller is to be cached
		 *
		 * @var boolean
		 */
		public $isCached = false;
				
		/**
	 	 * displays welcome page
	 	 */
		function index()
		{
			
		}
		
		function help()
		{
			$this->layout = 'empty';
		}
	
		/**
	 	 * displays login page
	 	 */
		function Login()
		{
			$this->layout = 'empty';
			if ($this->request->post)
			{
				if ($this->request->post[password] == 'vasea')
				{
					$_SESSION[adminid] = 'admin';
					if(isset($_SESSION[redirect_url]))
					{
						header("Location: {$_SESSION[redirect_url]}");
					}
					else
					{
						header("Location: /spanel/main/index/");
					}
				}
			}
		}

		/**
	 	 * displays logout page
	 	 */
		function Logout()
		{
			$_SESSION = array();
			header("Location: /spanel/main/login/"); exit();
		}
	}
?>